package com.grad.why.studentsystem.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.grad.why.studentsystem.domain.Menu;
import com.grad.why.studentsystem.domain.Moduleinfos;
import com.grad.why.studentsystem.domain.current.CurrentStudentEvaluateInfo;
import com.grad.why.studentsystem.mapper.MenuMapper;
import com.grad.why.studentsystem.mapper.ModuleinfosMapper;
import com.grad.why.studentsystem.service.ClassesTableService;
import com.grad.why.studentsystem.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;

@Component
@Service(interfaceClass = MenuService.class)
@Transactional
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MenuMapper menuMapper;

    @Autowired
    private ModuleinfosMapper moduleinfosMapper;

    @Override
    public ArrayList<Menu> getMenuInfos() {
        return menuMapper.getMenuInfos();
    }

    @Override
    public ArrayList<Menu> getMenuInfosByUserType(int type) {
        try{
            return menuMapper.getMenuInfosByUserType(type);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Menu getMenuInfoByMenuId(Integer menuid) {
        try{
            return menuMapper.selectByPrimaryKey(menuid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Moduleinfos getCurrentStudentEvaluateInfoById(Integer id) {
        try{
            return moduleinfosMapper.selectByPrimaryKey(id);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
